package com.qq.aidoctor.config;

import com.qq.aidoctor.store.MongoChatMemoryStore;
import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * &#064;Author  Bob
 *
 * &#064;Date：2025/6/8  10:01
 *
 * &#064;description：记忆存储的相关配置
 */
@Configuration
public class MemoryConfig {

    @Resource
    private MongoChatMemoryStore mongoChatMemoryStore;


    @Bean
    public ChatMemory chatMemory() {
        return MessageWindowChatMemory.withMaxMessages(10);
    }

    @Bean
    public ChatMemoryProvider chatMemoryProvider() {
        return memoryId -> MessageWindowChatMemory.builder()
                .id(memoryId)
                .maxMessages(10)
                .chatMemoryStore(mongoChatMemoryStore)
                .build();
    }

//    @Bean
//    public ChatMemoryProvider qianQianChatMemoryProvider() {
//        return memoryId -> MessageWindowChatMemory.builder()
//                .id(memoryId)
//                .maxMessages(20)
//                .chatMemoryStore(mongoChatMemoryStore)
//                .build();
//    }



}
